﻿// ===============================================================================
// XCI.Parent 西安交通信息WinForm开发框架 2019 版权所有
// ===============================================================================

using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraSplashScreen;
using XCI.Helper;
using XCI.Windows.Helper;

namespace XCI.Sys.Forms
{
    public partial class FrmFullSplashScreen : SplashScreen
    {
        public FrmFullSplashScreen()
        {
            InitializeComponent();
            SetStyle(ControlStyles.DoubleBuffer
                     | ControlStyles.AllPaintingInWmPaint
                     | ControlStyles.UserPaint, true);

            this.labTitle.Text = SysRuntime.Setting.Title;

            picLogo.Parent =
                labTitle.Parent =
                    labMessage.Parent = picBG;

            WinHelper.CenterControl(this, labTitle, this, true, false);
            //NativeMethods.SetForegroundWindow(this.Handle);
        }

        public override void ProcessCommand(Enum cmd, object arg)
        {
            base.ProcessCommand(cmd, arg);
            var command = (SplashCommand) cmd;
            if (command == SplashCommand.ShowMessage)
            {
                string msg = arg == null ? string.Empty : arg.ToString();
                labMessage.Text = msg;
            }
        }
    }
}